<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>ArNetworking: videoServerForwarder.cpp</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">ArNetworking
   &#160;<span id="projectnumber">dev20180125</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('videoServerForwarder_8cpp-example.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">videoServerForwarder.cpp</div>  </div>
</div><!--header-->
<div class="contents">
<p>Example ArNetworking server that also obtains images from ArVideo videoSubServer, ACTS, or savServer also running on the local host port 7070.To forward images from a video server (such as ArVideo videoServer) running on another host (computer), modify the arguments to ArHybridVideoForwarder below.</p>
<p>To incorporate video image capture directly into the same server program, see the ArVideo library documentation and examples, namely ArVideoConnector and ArVideoServer, and the videoServer example program.</p>
<p>This is a basic ArNetworking server. It connects to a robot or simulator, including, if available, IRs, gyro, and bumpers. Give the option "-connectLaser" on the command line to enable the laser rangefinder, if available.</p>
<p>Run "./videoServerForwarder -help" for a full list of command line options.</p>
<p>Once running, connect to this server with a a client such as MobileEyes.</p>
<p>This server provides the following services:</p><ul>
<li>User login (optional)</li>
<li>Basic robot telemetry information</li>
<li>Range sensor data values (not used by MobileEyes)</li>
<li>Graphics representing range sensor reading positions</li>
<li>Teleoperation modes (including safe/unsafe drive modes)</li>
<li>Wander mode</li>
<li>Various advanced "custom" commands to control logging, debugging, etc.</li>
<li>If an ACTS or SAV server is running, forward the video stream</li>
<li>Camera control (pan/tilt/zoom) if cameras are available</li>
</ul>
<p>Note that this program requires a terminal to run &ndash; i.e. you can't run it in the background in Linux. To modify it to allow that, remove the key handler code in <a class="el" href="videoServerForwarder_8cpp.html#a3c04138a5bfe5d72780bb7e82a18e627">main()</a>.</p>
<div class="fragment"><div class="line"><span class="comment">/*</span></div><div class="line"><span class="comment">Adept MobileRobots Robotics Interface for Applications (ARIA)</span></div><div class="line"><span class="comment">Copyright (C) 2004-2005 ActivMedia Robotics LLC</span></div><div class="line"><span class="comment">Copyright (C) 2006-2010 MobileRobots Inc.</span></div><div class="line"><span class="comment">Copyright (C) 2011-2015 Adept Technology, Inc.</span></div><div class="line"><span class="comment">Copyright (C) 2016 Omron Adept Technologies, Inc.</span></div><div class="line"><span class="comment"></span></div><div class="line"><span class="comment">     This program is free software; you can redistribute it and/or modify</span></div><div class="line"><span class="comment">     it under the terms of the GNU General Public License as published by</span></div><div class="line"><span class="comment">     the Free Software Foundation; either version 2 of the License, or</span></div><div class="line"><span class="comment">     (at your option) any later version.</span></div><div class="line"><span class="comment"></span></div><div class="line"><span class="comment">     This program is distributed in the hope that it will be useful,</span></div><div class="line"><span class="comment">     but WITHOUT ANY WARRANTY; without even the implied warranty of</span></div><div class="line"><span class="comment">     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span></div><div class="line"><span class="comment">     GNU General Public License for more details.</span></div><div class="line"><span class="comment"></span></div><div class="line"><span class="comment">     You should have received a copy of the GNU General Public License</span></div><div class="line"><span class="comment">     along with this program; if not, write to the Free Software</span></div><div class="line"><span class="comment">     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA</span></div><div class="line"><span class="comment"></span></div><div class="line"><span class="comment">If you wish to redistribute ARIA under different terms, contact </span></div><div class="line"><span class="comment">Adept MobileRobots for information about a commercial version of ARIA at </span></div><div class="line"><span class="comment">robots@mobilerobots.com or </span></div><div class="line"><span class="comment">Adept MobileRobots, 10 Columbia Drive, Amherst, NH 03031; +1-603-881-7960</span></div><div class="line"><span class="comment">*/</span></div><div class="line"><span class="preprocessor">#include &quot;Aria.h&quot;</span></div><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="ArNetworking_8h.html">ArNetworking.h</a>&quot;</span></div><div class="line"><span class="preprocessor">#include &quot;ArSonarMTX.h&quot;</span></div><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="ArServerModeJogPosition_8h.html">ArServerModeJogPosition.h</a>&quot;</span></div><div class="line"></div><div class="line"><span class="keywordtype">int</span> <a name="a0"></a><a class="code" href="videoServerForwarder_8cpp.html#a3c04138a5bfe5d72780bb7e82a18e627">main</a>(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv)</div><div class="line">{</div><div class="line">  <span class="comment">// mandatory init</span></div><div class="line">  <a name="a1"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classAria.html#ad99c16b5d947229d9f8e1c5b2d4cdd73">Aria::init</a>();</div><div class="line"></div><div class="line">  <span class="comment">//ArLog::init(ArLog::StdOut, ArLog::Verbose);</span></div><div class="line"></div><div class="line">  <span class="comment">// set up our parser</span></div><div class="line">  <a name="_a2"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArArgumentParser.html">ArArgumentParser</a> parser(&amp;argc, argv);</div><div class="line"></div><div class="line">  <span class="comment">// load the default arguments </span></div><div class="line">  parser.<a name="a3"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArArgumentParser.html#a501694b62a7f8b0c3cadd84aeafe1b35">loadDefaultArguments</a>();</div><div class="line"></div><div class="line">  <span class="comment">// robot</span></div><div class="line">  <a name="_a4"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArRobot.html">ArRobot</a> robot;</div><div class="line">  <span class="comment">// set up our simple connector</span></div><div class="line">  <a name="_a5"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArRobotConnector.html">ArRobotConnector</a> robotConnector(&amp;parser, &amp;robot);</div><div class="line"></div><div class="line"></div><div class="line">  <span class="comment">// add a gyro, it&#39;ll see if it should attach to the robot or not</span></div><div class="line">  <a name="_a6"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArAnalogGyro.html">ArAnalogGyro</a> gyro(&amp;robot);</div><div class="line"></div><div class="line"></div><div class="line">  <span class="comment">// set up the robot for connecting</span></div><div class="line">  <span class="keywordflow">if</span> (!robotConnector.<a name="a7"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArRobotConnector.html#ab192ac393d9cc1e5b61b1a82b08d085d">connectRobot</a>())</div><div class="line">  {</div><div class="line">    printf(<span class="stringliteral">&quot;Could not connect to robot... exiting\n&quot;</span>);</div><div class="line">    <a name="a8"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classAria.html#a6abc3d39b3e9548063bb8e78375acc17">Aria::exit</a>(1);</div><div class="line">  }</div><div class="line"></div><div class="line">  <a name="_a9"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArDataLogger.html">ArDataLogger</a> dataLogger(&amp;robot, <span class="stringliteral">&quot;dataLog.txt&quot;</span>);</div><div class="line">  dataLogger.<a name="a10"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArDataLogger.html#a28f4fc3cf8955e837378502de3707fda">addToConfig</a>(<a name="a11"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classAria.html#ace50b4190f04bcacaf285bb5830c5fc2">Aria::getConfig</a>());</div><div class="line">  </div><div class="line">  <span class="comment">// our base server object</span></div><div class="line">  <a name="_a12"></a><a class="code" href="classArServerBase.html">ArServerBase</a> server;</div><div class="line"></div><div class="line">  <a name="_a13"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArLaserConnector.html">ArLaserConnector</a> laserConnector(&amp;parser, &amp;robot, &amp;robotConnector);</div><div class="line">  <a name="_a14"></a><a class="code" href="classArServerSimpleOpener.html">ArServerSimpleOpener</a> simpleOpener(&amp;parser);</div><div class="line"></div><div class="line"></div><div class="line">  <a name="_a15"></a><a class="code" href="classArClientSwitchManager.html">ArClientSwitchManager</a> clientSwitchManager(&amp;server, &amp;parser);</div><div class="line"></div><div class="line">  <span class="comment">// parse the command line... fail and print the help if the parsing fails</span></div><div class="line">  <span class="comment">// or if the help was requested</span></div><div class="line">  <span class="keywordflow">if</span> (!<a name="a16"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classAria.html#a1b090c01d88bb420b8cf8e0384d25ee1">Aria::parseArgs</a>() || !parser.<a name="a17"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArArgumentParser.html#ac3889cbdfa862031c51bf80e06954914">checkHelpAndWarnUnparsed</a>())</div><div class="line">  {    </div><div class="line">    <a name="a18"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classAria.html#a10d71f3d4d0cf7f38c58a1f749f64a42">Aria::logOptions</a>();</div><div class="line">    <a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classAria.html#a6abc3d39b3e9548063bb8e78375acc17">Aria::exit</a>(1);</div><div class="line">  }</div><div class="line"></div><div class="line">  <span class="comment">// Set up where we&#39;ll look for files such as user/password </span></div><div class="line">  <span class="keywordtype">char</span> fileDir[1024];</div><div class="line">  <a name="a19"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArUtil.html#a196eae227f3e6fc7387bb623b4ddea03">ArUtil::addDirectories</a>(fileDir, <span class="keyword">sizeof</span>(fileDir), <a name="a20"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classAria.html#a9cbf9a172cb85275b05d391685f223e0">Aria::getDirectory</a>(), </div><div class="line">                         <span class="stringliteral">&quot;ArNetworking/examples&quot;</span>);</div><div class="line"></div><div class="line">  <span class="comment">// first open the server up</span></div><div class="line">  <span class="keywordflow">if</span> (!simpleOpener.<a name="a21"></a><a class="code" href="classArServerSimpleOpener.html#a6429c1069dee5edc19fb7dc94078bed0">open</a>(&amp;server, fileDir, 240))</div><div class="line">  {</div><div class="line">    <span class="keywordflow">if</span> (simpleOpener.<a name="a22"></a><a class="code" href="classArServerSimpleOpener.html#a7416e273f937d9301eb94ed02e04825d">wasUserFileBad</a>())</div><div class="line">      printf(<span class="stringliteral">&quot;Bad user/password/permissions file\n&quot;</span>);</div><div class="line">    <span class="keywordflow">else</span></div><div class="line">      printf(<span class="stringliteral">&quot;Could not open server port\n&quot;</span>);</div><div class="line">    exit(1);</div><div class="line">  }</div><div class="line"></div><div class="line">  <span class="comment">// Range devices:</span></div><div class="line"> </div><div class="line"> </div><div class="line">  <a name="_a23"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArSonarDevice.html">ArSonarDevice</a> sonarDev;</div><div class="line">  robot.<a name="a24"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArRobot.html#a97d57b28549fdef851c00749a97cc776">addRangeDevice</a>(&amp;sonarDev);</div><div class="line"></div><div class="line">  <a name="_a25"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArIRs.html">ArIRs</a> irs;</div><div class="line">  robot.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArRobot.html#a97d57b28549fdef851c00749a97cc776">addRangeDevice</a>(&amp;irs);</div><div class="line"></div><div class="line">  <a name="_a26"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArBumpers.html">ArBumpers</a> bumpers;</div><div class="line">  robot.<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArRobot.html#a97d57b28549fdef851c00749a97cc776">addRangeDevice</a>(&amp;bumpers);</div><div class="line"></div><div class="line">  <span class="comment">// attach services to the server</span></div><div class="line">  <a name="_a27"></a><a class="code" href="classArServerInfoRobot.html">ArServerInfoRobot</a> serverInfoRobot(&amp;server, &amp;robot);</div><div class="line">  <a name="_a28"></a><a class="code" href="classArServerInfoSensor.html">ArServerInfoSensor</a> serverInfoSensor(&amp;server, &amp;robot);</div><div class="line">  <a name="_a29"></a><a class="code" href="classArServerInfoDrawings.html">ArServerInfoDrawings</a> drawings(&amp;server);</div><div class="line"></div><div class="line">  <span class="comment">// modes for controlling robot movement</span></div><div class="line">  <a name="_a30"></a><a class="code" href="classArServerModeStop.html">ArServerModeStop</a> modeStop(&amp;server, &amp;robot);</div><div class="line">  <a name="_a31"></a><a class="code" href="classArServerModeRatioDrive.html">ArServerModeRatioDrive</a> modeRatioDrive(&amp;server, &amp;robot);  </div><div class="line">  <a name="_a32"></a><a class="code" href="classArServerModeWander.html">ArServerModeWander</a> modeWander(&amp;server, &amp;robot);</div><div class="line">  <a name="_a33"></a><a class="code" href="classArServerModeJogPosition.html">ArServerModeJogPosition</a> modeJog(&amp;server, &amp;robot);</div><div class="line">  modeJog.<a name="a34"></a><a class="code" href="classArServerModeJogPosition.html#ae804b49ae43c71bca7bd425ed1dd75c0">addToConfig</a>(<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classAria.html#ace50b4190f04bcacaf285bb5830c5fc2">Aria::getConfig</a>());</div><div class="line">  modeStop.<a name="a35"></a><a class="code" href="classArServerMode.html#ac071f8179603fecc38d69f8e89e88f34">addAsDefaultMode</a>();</div><div class="line">  modeStop.<a name="a36"></a><a class="code" href="classArServerModeStop.html#a701b1ae94cfda807e9f3d6c51a9fc53f">activate</a>();</div><div class="line"></div><div class="line">  <span class="comment">// set up the simple commands</span></div><div class="line">  <a name="_a37"></a><a class="code" href="classArServerHandlerCommands.html">ArServerHandlerCommands</a> commands(&amp;server);</div><div class="line">  <a name="_a38"></a><a class="code" href="classArServerSimpleComUC.html">ArServerSimpleComUC</a> uCCommands(&amp;commands, &amp;robot);  <span class="comment">// send commands directly to microcontroller</span></div><div class="line">  <a name="_a39"></a><a class="code" href="classArServerSimpleComMovementLogging.html">ArServerSimpleComMovementLogging</a> loggingCommands(&amp;commands, &amp;robot); <span class="comment">// control debug logging</span></div><div class="line">  <a name="_a40"></a><a class="code" href="classArServerSimpleComGyro.html">ArServerSimpleComGyro</a> gyroCommands(&amp;commands, &amp;robot, &amp;gyro); <span class="comment">// configure gyro</span></div><div class="line">  <a name="_a41"></a><a class="code" href="classArServerSimpleComLogRobotConfig.html">ArServerSimpleComLogRobotConfig</a> configCommands(&amp;commands, &amp;robot); <span class="comment">// control more debug logging</span></div><div class="line">  <a name="_a42"></a><a class="code" href="classArServerSimpleServerCommands.html">ArServerSimpleServerCommands</a> serverCommands(&amp;commands, &amp;server); <span class="comment">// control ArNetworking debug logging</span></div><div class="line">  <a name="_a43"></a><a class="code" href="classArServerSimpleLogRobotDebugPackets.html">ArServerSimpleLogRobotDebugPackets</a> logRobotDebugPackets(&amp;commands, &amp;robot, <span class="stringliteral">&quot;.&quot;</span>);  <span class="comment">// debugging tool</span></div><div class="line"></div><div class="line">  <span class="comment">// ArServerModeDrive is an older drive mode. ArServerModeRatioDrive is newer and generally performs better,</span></div><div class="line">  <span class="comment">// but you can use this for old clients if neccesary.</span></div><div class="line">  <span class="comment">//ArServerModeDrive modeDrive(&amp;server, &amp;robot);</span></div><div class="line">  <span class="comment">//modeDrive.addControlCommands(&amp;commands); // configure the drive modes (e.g. enable/disable safe drive)</span></div><div class="line"></div><div class="line">  <a name="_a44"></a><a class="code" href="classArServerHandlerConfig.html">ArServerHandlerConfig</a> serverHandlerConfig(&amp;server, <a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classAria.html#ace50b4190f04bcacaf285bb5830c5fc2">Aria::getConfig</a>()); <span class="comment">// make a config handler</span></div><div class="line">  <a name="a45"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArLog.html#a830b6edab2079ae1ffeb7e164e30636b">ArLog::addToConfig</a>(<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classAria.html#ace50b4190f04bcacaf285bb5830c5fc2">Aria::getConfig</a>()); <span class="comment">// let people configure logging</span></div><div class="line"></div><div class="line">  modeRatioDrive.<a name="a46"></a><a class="code" href="classArServerModeRatioDrive.html#a5f9789a3e51ca3f52d3efbd7be5d4c66">addToConfig</a>(<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classAria.html#ace50b4190f04bcacaf285bb5830c5fc2">Aria::getConfig</a>(), <span class="stringliteral">&quot;Teleop settings&quot;</span>); <span class="comment">// able to configure teleop settings</span></div><div class="line">  modeRatioDrive.<a name="a47"></a><a class="code" href="classArServerModeRatioDrive.html#a4f2e0b9b1cbdca73db31d95437e095b2">addControlCommands</a>(&amp;commands);</div><div class="line"></div><div class="line">  <span class="comment">// Forward video if either ACTS or SAV server are running.</span></div><div class="line">  <span class="comment">// You can find out more about SAV and ACTS on our website</span></div><div class="line">  <span class="comment">// http://robots.activmedia.com. ACTS is for color tracking and is</span></div><div class="line">  <span class="comment">// a separate product. SAV just does software A/V transmitting and is</span></div><div class="line">  <span class="comment">// free to all our customers. Just run ACTS or SAV server before you</span></div><div class="line">  <span class="comment">// start this program and this class here will forward video from the</span></div><div class="line">  <span class="comment">// server to the client.</span></div><div class="line">  <a name="_a48"></a><a class="code" href="classArHybridForwarderVideo.html">ArHybridForwarderVideo</a> videoForwarder(&amp;server, <span class="stringliteral">&quot;localhost&quot;</span>, 7070);</div><div class="line">  </div><div class="line">  <span class="comment">// Control a pan/tilt/zoom camera, if one is installed, and the video</span></div><div class="line">  <span class="comment">// forwarder was enabled above.</span></div><div class="line">  <a name="_a49"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArPTZ.html">ArPTZ</a> *camera = NULL;</div><div class="line">  <a name="_a50"></a><a class="code" href="classArServerHandlerCamera.html">ArServerHandlerCamera</a> *handlerCamera = NULL;</div><div class="line">  <a name="_a51"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArCameraCollection.html">ArCameraCollection</a> *cameraCollection = NULL;</div><div class="line">  <span class="keywordflow">if</span> (videoForwarder.<a name="a52"></a><a class="code" href="classArHybridForwarderVideo.html#af576fd70231e335e66a6a3b0e9f1fbea">isForwardingVideo</a>())</div><div class="line">  {</div><div class="line">    <span class="keywordtype">bool</span> invertedCamera = <span class="keyword">false</span>;</div><div class="line">    camera = <span class="keyword">new</span> <a name="_a53"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArVCC4.html">ArVCC4</a>(&amp;robot, invertedCamera, </div><div class="line">                        ArVCC4::COMM_UNKNOWN, <span class="keyword">true</span>, <span class="keyword">true</span>);</div><div class="line">    camera-&gt;<a name="a54"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArPTZ.html#adc51dbc6919fc6cde0e04985246c6a61">init</a>();</div><div class="line"></div><div class="line">    cameraCollection = <span class="keyword">new</span> <a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArCameraCollection.html">ArCameraCollection</a>();</div><div class="line">    cameraCollection-&gt;<a name="a55"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArCameraCollection.html#a4298508408621d2db978f1408a8dc27e">addCamera</a>(<span class="stringliteral">&quot;Cam1&quot;</span>, <span class="stringliteral">&quot;VCC4&quot;</span>, <span class="stringliteral">&quot;Camera&quot;</span>, <span class="stringliteral">&quot;VCC4&quot;</span>);</div><div class="line">    handlerCamera = <span class="keyword">new</span> <a class="code" href="classArServerHandlerCamera.html">ArServerHandlerCamera</a>(<span class="stringliteral">&quot;Cam1&quot;</span>, </div><div class="line">                                              &amp;server, </div><div class="line">                                              &amp;robot,</div><div class="line">                                              camera, </div><div class="line">                                              cameraCollection);</div><div class="line">  }</div><div class="line"></div><div class="line">  <span class="comment">// You can use this class to send a set of arbitrary strings </span></div><div class="line">  <span class="comment">// for MobileEyes to display, this is just a small example</span></div><div class="line">  <a name="_a56"></a><a class="code" href="classArServerInfoStrings.html">ArServerInfoStrings</a> stringInfo(&amp;server);</div><div class="line">  <a name="a57"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classAria.html#af1d44610d83bc5112040bc7d4c602ba9">Aria::getInfoGroup</a>()-&gt;<a name="a58"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArStringInfoGroup.html#a1e1784e772af0d6318ade1fe309f11db">addAddStringCallback</a>(stringInfo.<a name="a59"></a><a class="code" href="classArServerInfoStrings.html#a2c5ebea58bca4a8ad16ce5368e6f668c">getAddStringFunctor</a>());</div><div class="line">  <a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classAria.html#af1d44610d83bc5112040bc7d4c602ba9">Aria::getInfoGroup</a>()-&gt;<a name="a60"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArStringInfoGroup.html#a162b4a2e028e476787e5b2d1be532525">addStringInt</a>(</div><div class="line">          <span class="stringliteral">&quot;Motor Packet Count&quot;</span>, 10, </div><div class="line">          <span class="keyword">new</span> <a name="_a61"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArConstRetFunctorC.html">ArConstRetFunctorC&lt;int, ArRobot&gt;</a>(&amp;robot, </div><div class="line">                                               &amp;<a name="a62"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArRobot.html#a9eb53fc27147cd3467fa3254cbb829f0">ArRobot::getMotorPacCount</a>));</div><div class="line">  <span class="comment">/*</span></div><div class="line"><span class="comment">  Aria::getInfoGroup()-&gt;addStringInt(</span></div><div class="line"><span class="comment">          &quot;Laser Packet Count&quot;, 10, </span></div><div class="line"><span class="comment">          new ArRetFunctorC&lt;int, ArSick&gt;(&amp;sick, </span></div><div class="line"><span class="comment">                                         &amp;ArSick::getSickPacCount));</span></div><div class="line"><span class="comment">  */</span></div><div class="line">  </div><div class="line">  <span class="comment">// start the robot running, true means that if we lose connection the run thread stops</span></div><div class="line">  robot.<a name="a63"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArRobot.html#a3c3d878cfd11a2ef91230005a83bfcaa">runAsync</a>(<span class="keyword">true</span>);</div><div class="line"></div><div class="line"></div><div class="line">  <span class="comment">// connect the laser(s) if it was requested</span></div><div class="line">  <span class="keywordflow">if</span> (!laserConnector.<a name="a64"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArLaserConnector.html#ab97ce6a5fedebf44526773bc674b970e">connectLasers</a>())</div><div class="line">  {</div><div class="line">    <a name="a65"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArLog.html#a43a8b3789126c818f390f24bdbceccce">ArLog::log</a>(<a name="a66"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArLog.html#ac8cc0fb3aa323ab2a1c21340fdd1dce3a012daf6573594f91242f8dd7c02eb74b">ArLog::Terse</a>, <span class="stringliteral">&quot;videoServerForwarder: Warning: Could not connect to lasers.  Will continue but without laser sensing!&quot;</span>);</div><div class="line">    <span class="comment">//Aria::exit(2);</span></div><div class="line">  }</div><div class="line">  </div><div class="line"></div><div class="line">  drawings.<a name="a67"></a><a class="code" href="classArServerInfoDrawings.html#afce43fb3fd0324b092600c9eb6fb50a7">addRobotsRangeDevices</a>(&amp;robot);</div><div class="line"></div><div class="line">  <span class="comment">// log whatever we wanted to before the runAsync</span></div><div class="line">  simpleOpener.<a name="a68"></a><a class="code" href="classArServerSimpleOpener.html#ad05fedc301ab89072e61879999463d17">checkAndLog</a>();</div><div class="line">  <span class="comment">// now let it spin off in its own thread</span></div><div class="line">  server.<a name="a69"></a><a class="code" href="classArServerBase.html#a93c742ddc58a8f035a0d1b9c1fae4599">runAsync</a>();</div><div class="line"></div><div class="line"></div><div class="line">  <span class="comment">// Uncomment code below to add a key handler so that you can exit by pressing</span></div><div class="line">  <span class="comment">// escape. Note that a key handler prevents you from running</span></div><div class="line">  <span class="comment">// a program in the background on Linux, since it expects an </span></div><div class="line">  <span class="comment">// active terminal to read keys from; remove this if you want</span></div><div class="line">  <span class="comment">// to run it in the background.</span></div><div class="line"><span class="comment">/*</span></div><div class="line"><span class="comment">  ArKeyHandler *keyHandler;</span></div><div class="line"><span class="comment">  if ((keyHandler = Aria::getKeyHandler()) == NULL)</span></div><div class="line"><span class="comment">  {</span></div><div class="line"><span class="comment">    keyHandler = new ArKeyHandler;</span></div><div class="line"><span class="comment">    Aria::setKeyHandler(keyHandler);</span></div><div class="line"><span class="comment">    robot.lock();</span></div><div class="line"><span class="comment">    robot.attachKeyHandler(keyHandler);</span></div><div class="line"><span class="comment">    robot.unlock();</span></div><div class="line"><span class="comment">    printf(&quot;To exit, press escape.\n&quot;);</span></div><div class="line"><span class="comment">  }</span></div><div class="line"><span class="comment">*/</span></div><div class="line"></div><div class="line">  <span class="comment">// Read in parameter files.</span></div><div class="line">  std::string configFile = <span class="stringliteral">&quot;videoServerForwarderConfig.txt&quot;</span>;</div><div class="line">  <a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classAria.html#ace50b4190f04bcacaf285bb5830c5fc2">Aria::getConfig</a>()-&gt;<a name="a70"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArConfig.html#a5f9d30c8911050b8d510837d27f3e067">setBaseDirectory</a>(<span class="stringliteral">&quot;./&quot;</span>);</div><div class="line">  <span class="keywordflow">if</span> (<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classAria.html#ace50b4190f04bcacaf285bb5830c5fc2">Aria::getConfig</a>()-&gt;parseFile(configFile.c_str(), <span class="keyword">true</span>, <span class="keyword">true</span>))</div><div class="line">  {</div><div class="line">    <a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArLog.html#a43a8b3789126c818f390f24bdbceccce">ArLog::log</a>(<a name="a71"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArLog.html#ac8cc0fb3aa323ab2a1c21340fdd1dce3a7040faf60eeb155eaa85d439b1066ca1">ArLog::Normal</a>, <span class="stringliteral">&quot;Loaded config file %s&quot;</span>, configFile.c_str());</div><div class="line">  }</div><div class="line">  <span class="keywordflow">else</span></div><div class="line">  {</div><div class="line">    <span class="keywordflow">if</span> (<a name="a72"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArUtil.html#a731729868fac7cf87c9894fe024f8a6c">ArUtil::findFile</a>(configFile.c_str()))</div><div class="line">    {</div><div class="line">      <a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArLog.html#a43a8b3789126c818f390f24bdbceccce">ArLog::log</a>(<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArLog.html#ac8cc0fb3aa323ab2a1c21340fdd1dce3a7040faf60eeb155eaa85d439b1066ca1">ArLog::Normal</a>, </div><div class="line">                 <span class="stringliteral">&quot;Trouble loading configuration file %s, continuing&quot;</span>,</div><div class="line">                 configFile.c_str());</div><div class="line">    }</div><div class="line">    <span class="keywordflow">else</span></div><div class="line">    {</div><div class="line">      <a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArLog.html#a43a8b3789126c818f390f24bdbceccce">ArLog::log</a>(<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArLog.html#ac8cc0fb3aa323ab2a1c21340fdd1dce3a7040faf60eeb155eaa85d439b1066ca1">ArLog::Normal</a>, </div><div class="line">                 <span class="stringliteral">&quot;No configuration file %s, will try to create if config used&quot;</span>,</div><div class="line">                 configFile.c_str());</div><div class="line">    }</div><div class="line">  }</div><div class="line"></div><div class="line">  clientSwitchManager.<a name="a73"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArASyncTask.html#a3d9b25fe57d5d4c4a7146827798dcbe0">runAsync</a>();</div><div class="line"></div><div class="line">  robot.<a name="a74"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArRobot.html#a5aecc7ac998c9a31b82fdb904efa8609">lock</a>();</div><div class="line">  robot.<a name="a75"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/group__easy.html#gaa3657bebab0086dd14ed0c8c3f76dc8b">enableMotors</a>();</div><div class="line">  robot.<a name="a76"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArRobot.html#a403d9de010dc2b8d478cd0b14b2d9491">unlock</a>();</div><div class="line"></div><div class="line">  <a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArLog.html#a43a8b3789126c818f390f24bdbceccce">ArLog::log</a>(<a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classArLog.html#ac8cc0fb3aa323ab2a1c21340fdd1dce3a7040faf60eeb155eaa85d439b1066ca1">ArLog::Normal</a>, <span class="stringliteral">&quot;videoServerForwarder: Server is now running. Connect to %s with MobileEyes, clientDemo or another client.&quot;</span>, server.<a name="a77"></a><a class="code" href="classArServerBase.html#a901ba41d3054ff06210bb65fc6453cc9">getOpenOnIP</a>()?server.<a class="code" href="classArServerBase.html#a901ba41d3054ff06210bb65fc6453cc9">getOpenOnIP</a>():<span class="stringliteral">&quot;this host&quot;</span>);</div><div class="line"></div><div class="line">  robot.<a name="a78"></a><a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/group__easy.html#ga95201be7c39b521983b51e6f5d9303e4">waitForRunExit</a>();</div><div class="line">  <a class="codeRef" doxygen="/home/reed/amrsw/Aria/docs/Aria.tag:../../docs/" href="../../docs/classAria.html#a6abc3d39b3e9548063bb8e78375acc17">Aria::exit</a>(0);</div><div class="line">}</div><div class="line"></div><div class="line"></div></div><!-- fragment --> </div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
  </ul>
</div>
</body>
</html>
